import React,{Component} from 'react'

export default class Child extends Component{
    constructor(){
        super()
        this.state = {
            val : '123'
        }
    }
    handlerChange=(e)=>{
        this.state({
            val :e.target.value
        })
    }
    handlerSend=()=>{
        var getVal = this.state.val;
        this.props.send(getVal)

    }
    render(){
        return(
            <div>
                
                <h1>Child</h1>

                <div>{this.props.data}</div>

                <input type="text" value={this.state.val} onChange={this.handlerChange}/>

                <button onClick={this.handlerSend}>点击发送</button>

            </div>
        )
    }
}